const AmmeterInfo = require("../models/db/AmmeterInfo");
const PressureMeterInfo = require("../models/db/PressureMeterInfo");
const TemperatureMeterInfo = require("../models/db/TemperatureMeterInfo");
const WaterMeterInfo = require("../models/db/WaterMeterInfo");
const LiquidLevelInfo = require("../models/db/LiquidLevelInfo");
const {setMeterStats} = require("../models/redisModel");




// 创建 电表
async function createAmmeterServer( alias , username ) {
    return await AmmeterInfo.create({
        alias: alias,
        username: username
    });
}

// 创建 水表
async function createWaterMeterServer(alias , unit , username ) {
    return await WaterMeterInfo.create({
        alias: alias,
        unit: unit,
        username: username
    });
}


// 创建 压力表
async function createPressureMeterServer( alias , unit ,range , username ) {
    console.log(123)
    return await PressureMeterInfo.create({
        alias: alias,
        unit: unit,
        range: range,
        username: username
    });
}

// 创建 三叉表
async function createTrifurcateMeterServer( alias , unit ,range , username ) {
    return await TrifurcateMeterInfo.create({
        alias: alias,
        unit: unit,
        range: range,
        username: username
    });
}

// 创建 指示器
async function createIndicatorServer( alias , username ) {
    console.log( alias , username )
    return await IndicatorMeterInfo.create({
        alias: alias, //别名
        username: username
    });
}

//  液位计
async function createLiquidLevelServer(alias, username) {
    return await LiquidLevelInfo.create({
        alias: alias,     // 液位计的别名
        username: username // 关联的用户名
    });
}

// 创建 温度表
async function createTemperatureMeterServer(alias , unit ,range , username) {
    return await TemperatureMeterInfo.create({
        alias: alias,
        unit: unit,
        range: range,
        username: username
    });
}




module.exports = {
    createAmmeterServer,
    createWaterMeterServer,
    createPressureMeterServer,
    createTemperatureMeterServer,
    createIndicatorServer,
    createTrifurcateMeterServer, // 三叉表
    createLiquidLevelServer // 液位计
}